#include "StdAfx.h"
#include "OSMutex.h"
#include <stdlib.h>
#include <string.h>

OSMutex::OSMutex()
{

	::InitializeCriticalSection(&fMutex);

}

OSMutex::~OSMutex()
{
    ::DeleteCriticalSection(&fMutex);

}


void        OSMutex::Lock()
{

    ::EnterCriticalSection(&fMutex);


}

void        OSMutex::Unlock()
{
       

        ::LeaveCriticalSection(&fMutex);


}

BOOL     OSMutex::TryLock()
{


    BOOL theErr = (BOOL)::TryEnterCriticalSection(&fMutex); // Return values of this function match our API
    
        return theErr;
	

}

